import Vue from 'vue';//引入Vue对象，因为要用它的use
import Router from 'vue-router'; // 引入下载的vue-router

// 使用路由插件
Vue.use(Router);

// 引入你需要配置的组件
import Home from "../components/views/Home.vue";
import Sort from "../components/views/Sort.vue"
import Mine from "../components/views/Mine.vue";
import Cart from "../components/views/Cart.vue";
import Login from "../components/views/Login.vue";
import Register from "../components/views/Register.vue";
import City from "../components/views/City.vue"
import Search from "../components/views/Search.vue"

// 路由列表
const routes = [
    // 路由默认打开Home页面
    {
        path: "/",
        redirect: '/Home'
    },
    {
        name: "Home",
        path: "/Home",
        component: Home
    },
    {
        path: "/Sort",
        component: Sort
    },
    {
        path: "/Mine",
        component: Mine
    },
    {
        path: "/Cart",
        component: Cart
    },
    {
        path: "/Login",
        component: Login
    },
    {
        path: "/Register",
        component: Register
    },
    {
        path: "/Search",
        component: Search
    },
    {
        path: "/City",
        component: City
    },
]

// 配置路由
const router = new Router({
    routes,
    mode: "history"
});

// 导出
export default router;